package org.apache.flink.runtime.messages;

import java.io.Serializable;
import java.util.Collection;
import java.util.Map;

import org.apache.flink.runtime.resourceconsumer.ConsumeAttemptID;
import org.apache.flink.util.Preconditions;

/** Response to the request to collect thread details samples. */
public class ThreadInfoResponse implements Serializable {

    private static final long serialVersionUID = -4786454630050578031L;

    private final Map<ConsumeAttemptID, Collection<ThreadInfoSample>> samples;

    /**
     * Creates a response to the request to collect thread details samples.
     *
     * @param samples Thread info samples.
     */
    public ThreadInfoResponse(Map<ConsumeAttemptID, Collection<ThreadInfoSample>> samples) {
        this.samples = Preconditions.checkNotNull(samples);
    }

    /**
     * Returns a collection of ThreadInfoSample.
     *
     * @return A collection of thread info samples for a particular execution attempt (Task)
     */
    public Map<ConsumeAttemptID, Collection<ThreadInfoSample>> getSamples() {
        return samples;
    }
}
